package com.info.zhiduoduo.alipay.constant;

import com.info.zhiduoduo.common.constants.EnumFindHelper;

/**
 * 支付宝账户类型
 */
public enum AlipayIdentityEnum {

	USER_ID(1, "ALIPAY_USER_ID","支付宝的会员ID, 2088开头的16位数字"),
	LOGON_ID(2,"ALIPAY_LOGON_ID", "支付宝登录号，支持邮箱和手机号格式"),
	BANKCARD_ACCOUNT(3, "BANKCARD_ACCOUNT","银行卡账户"),
	ACCOUNT_BOOK_ID(4, "ACCOUNT_BOOK_ID","创客企业支付宝的资金记账本"),
	;

	public int id;
	public String code;
	public String name;

	AlipayIdentityEnum(int id, String code, String name) {
		this.id = id;
		this.code = code;
		this.name = name;
	}

	//####################################### 方便查找枚举值的方法 ###################################//

	static final EnumFindHelper<AlipayIdentityEnum, Integer> IdHelper = new EnumFindHelper<>(AlipayIdentityEnum.class, e -> e.id);

	static final EnumFindHelper<AlipayIdentityEnum, String> NameHelper = new EnumFindHelper<>(AlipayIdentityEnum.class, e -> e.name);

	public static AlipayIdentityEnum findById(int id) {
		return IdHelper.find(id, USER_ID);
	}

	public static AlipayIdentityEnum findByName(String name) {
		return NameHelper.find(name, USER_ID);
	}
}
